package dao;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.classic.Session;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import to.Questao;
import util.HibernateUtil;

public class QuestaoDAO {

	public List<Questao> buscaTodasQuestao() {

		List<Questao> listaRetorno = new ArrayList<Questao>();
		Session session = null;

		try {

			session = HibernateUtil.getSessionFactory().openSession();
			Criteria criteria = session.createCriteria(Questao.class);
			criteria.addOrder(Order.asc("id"));
			listaRetorno = (List<Questao>) criteria.list();

		} catch (Exception e) {
			e.printStackTrace();
		}

		return listaRetorno;
	}

}
